package com.example.barcodescanner;

import com.adtouch.shoppingcart.ShoppingCartHelper;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class OrderActivity extends Activity{

	Button placeorder;
	EditText cardno;
	EditText cardname;
	EditText cvv;
	EditText add;
	EditText add1;
	EditText city;
	EditText state;
	EditText zip;
	EditText month;
	EditText year;
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_creditcard);
	
	placeorder=(Button)findViewById(R.id.bOrder);
	cardno= (EditText)findViewById(R.id.etCardnumber);
	cardname=(EditText)findViewById(R.id.etCardname);
	cvv=(EditText) findViewById(R.id.etCvv);
	add=(EditText) findViewById(R.id.etAdd1);
	add1=(EditText)findViewById(R.id.etAdd2);
	city=(EditText)findViewById(R.id.etCity);
	state=(EditText)findViewById(R.id.etZip);
	month=(EditText)findViewById(R.id.etMonth);
	year=(EditText)findViewById(R.id.etYear);
	
	
	placeorder.setOnClickListener(new View.OnClickListener() {
		
		@Override
		public void onClick(View arg0) {
			// TODO Auto-generated method stub
			if(cardno.getText().toString().matches("")|| cardname.getText().toString().matches("") || cvv.getText().toString().matches("") ||month.getText().toString().matches("") || year.getText().toString().matches("") || add.getText().toString().matches("") || city.getText().toString().matches("") || state.getText().toString().matches("") )
			{
				Toast toast = Toast.makeText(getApplicationContext(), "Please enter all details",
  	      				 Toast.LENGTH_LONG);
  	      				 toast.show();
			}
			else
			{
				Intent st= new Intent(getApplicationContext(), CongratsActivity.class);
				startActivity(st);
				ShoppingCartHelper.emptycart();
			}
			
		}
	});
	}
}
